package main

import (
	"context"
	"net/http"

	ll "gitee.com/linakesi/lzc-sdk/lang/go"
	"github.com/gin-gonic/gin"
	"github.com/linakesi/lnksutils"
	"google.golang.org/protobuf/types/known/emptypb"
)

var log = lnksutils.Logger("hello")

func main() {
	lnksutils.EnableLogDetail("hello")

	// lzc sdk提供的api服务
	sdk, err := ll.NewAPIGateway(context.Background())
	if err != nil {
		log.Panicf("New APIGateway failed: %v", err)
	}

	// 查询微服信息
	boxinfo , err :=sdk.Box.QueryInfo(context.TODO(), &emptypb.Empty{})
	if err !=nil {
		log.Errorf("Query boxinfo failed: %v", err)
		return
	}
	log.Infoln("boxinfo:", boxinfo)

	// 自己实现的http server，暴露在8900
	r := gin.Default()
	r.GET("/ping", func(ctx *gin.Context) {
		ctx.String(http.StatusOK, "pong")
	})
	r.Run(":8900")
}
